/**************************************************************************
  Copyright (C), 2014- ,  申议实业
  File name:      LED_matrix.ino
  Author: jiangzhaohui      Version: v1.0      Date: 2014.12.26
  Description: 在LED点阵上显示数字和26个字母
  Others:         
  Function List:  
  History:  
                  
    1. Date: 2014.12.26       Author:
       Modification: 代码创建
    2. ...
****************************************************************************/
#include "Config.h"

#define NumDevices  1 //定义板上LED点阵的设备数,本板只有一个点阵,因此为1

const static byte char_pic[8] = {0x00,0x66,0x99,0x81,0x81,0x42,0x24,0x18};  //显示桃心

/*字符数组*/
const static byte mychar[288] = {0x30,0x48,0x48,0x48,0x48,0x48,0x30,0x00, /* 0 */
                                 0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00, /* 1 */
                                 0x30,0x48,0x08,0x10,0x20,0x40,0x78,0x00, /* 2 */
                                 0x30,0x48,0x08,0x30,0x08,0x48,0x30,0x00, /* 3 */
                                 0x10,0x30,0x30,0x50,0x50,0x78,0x10,0x00, /* 4 */
                                 0x78,0x40,0x40,0x70,0x08,0x08,0x70,0x00, /* 5 */
                                 0x30,0x48,0x40,0x70,0x48,0x48,0x30,0x00, /* 6 */
                                 0x78,0x48,0x08,0x10,0x20,0x20,0x20,0x00, /* 7 */
                                 0x30,0x48,0x48,0x30,0x48,0x48,0x30,0x00, /* 8 */
                                 0x30,0x48,0x48,0x38,0x08,0x48,0x30,0x00, /* 9 */
                                 0x30,0x48,0x48,0x48,0x78,0x48,0x48,0x00, /* A */
                                 0x70,0x48,0x48,0x70,0x48,0x48,0x70,0x00, /* B */
                                 0x30,0x48,0x40,0x40,0x40,0x48,0x30,0x00, /* C */
                                 0x70,0x48,0x48,0x48,0x48,0x48,0x70,0x00, /* D */
                                 0x78,0x40,0x40,0x70,0x40,0x40,0x78,0x00, /* E */
                                 0x78,0x40,0x40,0x70,0x40,0x40,0x40,0x00, /* F */
                                 0x30,0x48,0x40,0x58,0x48,0x48,0x30,0x00, /* G */
                                 0x48,0x48,0x48,0x78,0x48,0x48,0x48,0x00, /* H */
                                 0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00, /* I */
                                 0x08,0x08,0x08,0x08,0x48,0x48,0x30,0x00, /* J */
                                 0x48,0x48,0x50,0x60,0x50,0x48,0x48,0x00, /* K */
                                 0x40,0x40,0x40,0x40,0x40,0x40,0x78,0x00, /* L */
                                 0x48,0x78,0x78,0x48,0x48,0x48,0x48,0x00, /* M */
                                 0x48,0x68,0x68,0x58,0x58,0x48,0x48,0x00, /* N */
                                 0x78,0x48,0x48,0x48,0x48,0x48,0x78,0x00, /* O */
                                 0x70,0x48,0x48,0x70,0x40,0x40,0x40,0x00, /* P */
                                 0x30,0x48,0x48,0x48,0x68,0x58,0x38,0x00, /* Q */
                                 0x70,0x48,0x48,0x70,0x60,0x50,0x48,0x00, /* R */
                                 0x30,0x48,0x40,0x30,0x08,0x48,0x30,0x00, /* S */
                                 0x78,0x20,0x20,0x20,0x20,0x20,0x20,0x00, /* T */
                                 0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x00, /* U */
                                 0x48,0x48,0x48,0x48,0x30,0x30,0x30,0x00, /* V */
                                 0x48,0x48,0x48,0x48,0x78,0x78,0x48,0x00, /* W */
                                 0x48,0x48,0x30,0x30,0x30,0x48,0x48,0x00, /* X */
                                 0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00, /* Y */
                                 0x78,0x08,0x10,0x30,0x20,0x40,0x78,0x00}; /* Z */

LedControl LedCtrl(PIN_MATRIX_LED_DIN, PIN_MATRIX_LED_CLK, PIN_MATRIX_LED_CS,NumDevices); //创建一个LED点阵对象

void setup()
{
  LedCtrl.shutdown(0, false);  //指定max7219从待机模式进入正常工作模式
}

void loop()
{
  for(unsigned char i=0;i<38;i++)      //依次显示0-9数字和A-Z字母
  {
    for(int j=i*8;j<i*8+8;j++)
    {
      LedCtrl.setRow(0,j%8,mychar[j]);  //从数组中取数据显示
    }
    delay(500);  //延时500ms
  }
}						
				
